/*
 * $Id: DbAppController.java 55 2009-05-11 08:41:42Z donbeave $
 */

package labour.dbmanager.client.mvc;

import labour.dbmanager.client.DbManagerEvents;
import labour.manager.client.AppEvents;

import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;

public class DbAppController extends Controller {

  private DbAppView appView;
  private AppEvent currentEvent;

  public DbAppController() {
    registerEventTypes(AppEvents.Prepare);
  }

  @Override
  public void initialize() {
    appView = new DbAppView(this);
  }

  @Override
  public void handleEvent(AppEvent event) {
    currentEvent = event;

    if (event.getType() == AppEvents.Prepare) {
      onPrepare();
    }
  }

  private void onPrepare() {
    forwardToView(appView, currentEvent);
  }

}